package hmove;

 /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.game.Sprite;
import javax.microedition.lcdui.Image;
import main.*;

public class MoveRazorLeaf extends Move {

    public MoveRazorLeaf(Pokemon pokemon) {
        String fileName = "/grass.png";
        int w = 24;
        int h = 24;

        try {
            _sprite = new Sprite(Image.createImage(fileName), w, h);
            throwingObject = new ThrewObject();
            _sprite.defineReferencePixel(w / 2, h / 2);
            _sprite.defineCollisionRectangle(0, 0, w, h);
        } catch (Exception ex) {
        }
        _damage = 100;
        _pokemonOwner = pokemon;
    }

    public boolean hit(Pokemon pokemon) {
        if (_sprite.collidesWith(pokemon.getSprite(), true)&& pokemon!= _pokemonOwner) {
            pokemon.incHp(-_damage);
            return true;
        }
        return false;
    }

   /* public boolean run(Sprite map) {
        int x = _sprite.getRefPixelX();
        int y = _sprite.getRefPixelY();
        Point positionPoint = new Point(x, y);
        throwingObject.run(positionPoint);   
        _sprite.nextFrame();
        boolean checkCollides = count>1;
        count++;
        return (ThrewObject.moveSpriteTo(_sprite, map, positionPoint.getX(), positionPoint.getY(),checkCollides) 
                || positionPoint.getY() > map.getHeight() || positionPoint.getX() < 0 || positionPoint.getX() > map.getWidth() );

    }*/

    public Sprite getObserveSprite() {
        return _sprite;
    }
}
